home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 21
/
Aminet 21 (1997)(GTI - Schatztruhe)[!][Oct 1997].iso
/
Aminet
/
game
/
patch
/
pxhd.lha
/
ProjectX
/
src
/
pxhdsrc
/
pxhd.asm
< prev
Wrap
Assembly Source File
|
1997-08-12
|
5KB
|
345 lines
; *** Project-X Hard Disk Loader V1.3
; *** Written by Jean-François Fabre
include "/lib/libs.i"
include "/lib/macros.i"
include "/lib/refs.i"
HD_PARAMS "ProjectX.d","CON:20/20/350/200/Project-X HD Loader",STD_DISK_SIZE,4
_loader:
move.l D0,trainer
move.l D1,noosswap
Mac_printf "Project-X HD Loader V1.3c"
Mac_printf "Coded by Jean-François Fabre © 1997"
tst.l D0
beq skip$
; NEWLINE
; Mac_printf "Trainer activated"
skip$
JSRABS LoadDisks
JSRABS TransfRoutines
bsr GetVersion
; *** Tries to allocate memory for extension
move.l #MEMF_FAST,D1
move.l _SysBase,A6
JSRLIB AvailMem
move.l D0,D6
cmp.l #$200000,D6 ; more than 2 mb of fastmem available
bcs lowmem$ ; no
move.l #$100000,D0
JSRABS AllocExtMem
move.l D0,ExtBase
bne onemeg$
lowmem$
move.l #$80000,D0
JSRABS AllocExtMem
move.l D0,ExtBase
beq MemErr
bra cont$
onemeg$
add.l #$80000,D0
move.l D0,ExtBase2
beq MemErr
cont$
moveq.l #0,D0
move.l #CACRF_CopyBack,D1
JSRABS Degrade
; WAIT_LMB
RELOCATE version
RELOCATE ExtBase
RELOCATE ExtBase2
GO_SUPERVISOR
SAVE_OSDATA $80000
GETUSRADDR BootGame
move.l D0,A0
jmp (A0)
GetVersion
moveq.l #0,D0
moveq.l #$C,D2 ; offset
moveq.l #4,D1 ; length
lea versiontag(pc),A0
JSRGEN ReadDiskPart
move.l (A0),D0
cmp.l #$2F09203C,D0
bne notv1$
move.l #1,version
rts
notv1$
cmp.l #$33FC0020,D0
bne notv2$
move.l #2,version
rts
notv2$
Mac_printf "** Unsupported Project-X version. Contact the author"
JMPABS CloseAll
MemErr:
Mac_printf "** Not enough memory to run Project-X"
JMPABS CloseAll
versiontag:
dc.l 0,0
_UserPatchRoutines:
BootGame:
; **** boot stuff and patch
JSRGEN InitTrackDisk
lea $70000,A3
MOVE.L A3,40(A1) ;2C: 234B0028
MOVE.L #$00001000,36(A1) ;30: 237C000010000024
MOVE.L #$0006E600,44(A1) ;38: 237C0006E600002C
MOVE #$0002,28(A1) ;40: 337C0002001C
JSRGEN TrackLoad
move.l #$400,$144(A3)
move.l ExtBase(pc),$140(A3)
move.l ExtBase2(pc),$13C(A3)
GETUSRADDR PatchLoader1
move.l D0,$138(A3)
move.l version(pc),D0
cmp.l #1,D0
bne 3$
lea $8A8(A3),A4
bra verok$
3$
cmp.l #2,D0
bne 2$
lea $89A(A3),A4
bra verok$
2$
verok$
PATCHUSRJMP (A4),ReadSectors1
PATCHUSRJMP ($E6,A3),PatchLoader1
lea $80000,A7
JSRGEN FlushCachesHard
JMP $70(A3)
PatchLoader1:
STORE_REGS
move.l ExtBase(pc),A0
move.l version(pc),D0
cmp.l #2,D0
beq v2$
PATCHUSRJMP ($46B4,A0),ReadSectors2
PATCHUSRJMP ($3CFE,A0),PatchAfterATN
lea hiscore_offset(pc),A1
move.l #$57CE,(A1)
bra vcom$
v2$
PATCHUSRJMP ($465E,A0),ReadSectors2
PATCHUSRJMP ($3CA8,A0),PatchAfterATN
lea hiscore_offset(pc),A1
move.l #$5778,(A1)
vcom$
; *** read high scores
move.l noosswap(pc),D4
bne skip$
move.l hiscore_offset(pc),A1
add.l A0,A1
lea hiscname(pc),A0
moveq.l #0,D0
move.l #$A0,D1
JSRGEN ReadFileHD
skip$
JSRGEN FlushCachesHard
RESTORE_REGS
move.l $7013C,D0
jmp (A0)
PatchAfterATN:
STORE_REGS
move.l ExtBase(pc),A0
; *** different offsets depending on the version
move.l version(pc),D0
cmp.l #1,D0
bne nopkb_v1$
; *** test quit key during game
move.l A0,A2
add.l #$1FEE6,A2
cmp.w #$1039,(A2)
bne kb1$
PATCHUSRJSR (A2),kbint
; *** test quit key during menu
kb1$
cmp.w #$1039,$1D3E(A0)
bne nopkb_v1$
PATCHUSRJSR ($1D3E,A0),kbint
nopkb_v1$
cmp.l #2,version
bne nopkb_v2$
; *** test quit key during game
move.l A0,A2
add.l #$1FE90,A2
cmp.w #$1039,(A2)
bne kb2$
PATCHUSRJSR (A2),kbint
; *** test quit key during menu
kb2$
cmp.w #$1039,$1CE8(A0)
bne nopkb_v2$
PATCHUSRJSR ($1CE8,A0),kbint
nopkb_v2$
; *** common to both versions
cmp.w #$41F9,$408.W
bne noppr$
move.w #$4E75,$408.W
noppr$
cmp.w #$2E28,$1984.W
bne noplc$
move.l #$7E024E71,$1984.W
noplc$
JSRGEN ResetSprites
JSRGEN FlushCachesHard
RESTORE_REGS
movem.l (A7)+,D2-D5/A2-A4
tst.l D0
RTS
kbint:
move.b $BFEC01,D0
move.l D0,-(sp)
not.b D0
ror.b #1,D0
cmp.b #$5F,D0
bne noquit$
JSRGEN InGameExit
noquit$
move.l (sp)+,D0
rts
ReadSectors1:
ReadSectors2:
STORE_REGS
cmp.b #1,D3 ; write?
beq write$
tst.w D1
beq exit$
JSRGEN ReadRobSectors
exit$
RESTORE_REGS
moveq.l #0,D0
tst.l D0
rts
write$
; *** read high scores
move.l ExtBase(pc),A1
add.l hiscore_offset(pc),A1
cmp.l A1,A0
bne exit$
bsr WriteScores
bra exit$
WriteScores:
STORE_REGS
tst.l noosswap
bne skip$
move.l ExtBase(pc),A1
add.l hiscore_offset(pc),A1
lea hiscname(pc),A0
moveq.l #0,D0
move.l #$A0,D1
JSRGEN WriteFileHD
skip$
RESTORE_REGS
rts
_user_pbuffer:
dc.l 0
_general_pbuffer:
dc.l 0
ExtBase:
dc.l 0
ExtBase2:
dc.l 0
trainer:
dc.l 0
noosswap:
dc.l 0
version:
dc.l 0
hiscore_offset:
dc.l 0
hiscname:
dc.b "px.high",0
even
_EndUserPatchRoutines: